<script>
import Common from "@/mixins/order/common.js";
import OrderService from "@/api/order/OrderService.js";
import PPMForm from "@/crm3.0part7-ppm/core/ppmForm.vue";
export default {
  name: "bandSource19928",
  mixins: [PPMForm, Common],
  data() {
    return {};
  },
  mounted() {
    this.init();
  },
  computed: {},
  methods: {
    init() {
      this.formData["22746-100013698"].isshow = false;
      this.formData["22746-100013699"].isshow = false;

      var cacheInfo = JSON.parse(localStorage.getItem("cacheInfo"));
      
      //节点名称
      this.formData["22746-141000044"].value = cacheInfo.nodeName;

      //填报期限
      this.formData["22756-100012611"].value = cacheInfo.taskReqDate;

      //填报日期
      this.formData["22756-100012440"].value = this.$util.dateFormat(
        new Date(),
        "yyyy-MM-dd"
      );
      //填报人
      this.formData["22756-100012377"].value = cacheInfo.staffName;

      //联系电话
      this.formData["22756-141000045"].value = cacheInfo.linkTel;

      //城域内时延(ms)
      
      if (cacheInfo.taskId == "TACHE00040001") {
        this.formData["10461611-142001020"].isshow = false;
        this.SetRequired("1", "10461611-142001019");
      }
      if (cacheInfo.taskId == "TACHE00040002") {
        this.formData["10461611-142001019"].isshow = false;
        this.SetRequired("1", "10461611-142001020");
      }

      //判断是否隐藏 低时延
      let prodOfferId = cacheInfo.prodOfferId;
      if (
        prodOfferId == "10010111" ||
        prodOfferId == "10010022" ||
        prodOfferId == "10010021"
      ) {
        // 判读 是否为国内低时延电路
        // if (
        //   // ISDSY == 2 ||
        //   CIRCUIT_DIRECT_TYPE == "9006003" ||
        //   CIRCUIT_DIRECT_TYPE == "9006004"
        // ) {
        //   this.Isshow("0", "10461611"); //低时延电路时资源情况 隐藏c
        // } else {
        //   // if (ISDSY == 1) {
        //   //   if (taskId == "TACHE00040001") {
        //   //     this.formData["22749-142001020"].isshow = false;
        //   //   }
        //   //   if (taskId == "TACHE00040002") {
        //   //     if (CIRCUIT_DIRECT_TYPE == "9006001") {
        //   //       this.Isshow("0", "10461611"); //低时延电路时资源情况 隐藏
        //   //     }
        //   //     this.formData["22749-142001019"].isshow = false;
        //   //   }
        //   // }
        // }
      }
    },

    //是否需租用第三方资源
    hideTheOtherPart() {
      if (1 == this.formData["22746-100012871"].value) {
        // 
        this.formData["22746-100013698"].isshow = true;
        this.formData["22746-100013699"].isshow = true;
        this.SetRequired("1", "22746-100013698");
        this.SetRequired("1", "22746-100013699");
      } else {
        // 
        this.formData["22746-100013698"].isshow = false;
        this.formData["22746-100013699"].isshow = false;
        this.SetRequired("0", "22746-100013698");
        this.SetRequired("0", "22746-100013699");
      }
    },

    MTU() {
      var that = this;
      
      if ("10803002" == this.formData["22746-141000168"].value) {
        let MTUnbr = "";

        this.$prompt("可支持MTU数值", "请输入", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          inputPattern: /^[1-9]\d*$/,
          inputErrorMessage: "MTU数值格式不正确",
        })
          .then(({ value }) => {
            that.formData["22746-141000170"].value = value;
            that.formData["22746-141000168"].value = "10803002";
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "取消输入",
            });
          });
      } else {
        if ("10803001" == this.formData["22746-141000168"].value) {
          that.formData["22746-141000170"].value = "";
        }
      }
    },

    //电路维护等级具备
    range() {
      var levelMainFlag = this.formData["22747-100012783"].value;
      // if (levelMainFlag == "9005001") {
      //   //电路维护等级具备 修改为不编辑
      //   this.formData["22747-100012749"].disabled = true;
      // }
      if (levelMainFlag == "9005002") {
        this.formData["22747-100012783"].disabled = false; //可编辑
        this.SetRequired("1", "22747-100012749"); //必填验证设置//修改为必填
      }
    },

    //外线资源
    Duration() {
      let dateHave = this.formData["22755-100013702"].value;
      if (dateHave == "9005001") {
        //如果具备 工期还不能修改 且置空
        this.SetRequired("0", "22755-100013706");
      }
      if (dateHave == "9005002") {
        //如果具备 工期还不能修改 且置空
        this.SetRequired("1", "22755-100013706");
      }
    },

    //接入局上联中继资源
    Duration_Access() {
      let dateHave = this.formData["22746-100013700"].value;
      if (dateHave == "9005001") {
        //如果具备 工期还不能修改 且置空
        this.SetRequired("0", "22746-100013704");
      }
      if (dateHave == "9005002") {
        //如果具备 工期还不能修改 且置空
        this.SetRequired("1", "22746-100013704");
      }
    },

    //接入局上联中继资源(含端口)
    Duration_Port() {
      let dateHave = this.formData["22746-100013701"].value;
      if (dateHave == "9005001") {
        //如果具备 工期还不能修改 且置空
        this.SetRequired("0", "22746-100013705");
      }
      if (dateHave == "9005002") {
        //如果具备 工期还不能修改 且置空
        this.SetRequired("1", "22746-100013705");
      }
    },

    //客户端电信设备资源(含端口)
    Cust_Port() {
      let dateHave = this.formData["22755-100013703"].value;
      if (dateHave == "9005001") {
        //如果具备 工期还不能修改 且置空
        this.SetRequired("0", "22755-100013707");
      }
      if (dateHave == "9005002") {
        //如果具备 工期还不能修改 且置空
        this.SetRequired("1", "22755-100013707");
      }
    },

    // 判断 是否为国内低时延电路
  },
};
</script>

